<!DOCTYPE html>
<%@page import="fr.insta.reverse.uml.util.IhmValues"%>
<%@page import="fr.insta.reverse.uml.routing.Route"%>
<%@page import="fr.insta.reverse.uml.bean.User"%>
<%@page contentType="text/html; charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%
boolean useJquery = request.getAttribute("useJquery") != null && (Boolean) request.getAttribute("useJquery");
%>


<html>
	<head>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/ressource/css/style.css">
		
		<script src="<%=request.getContextPath()%>/ressource/js/functions.js"></script>
		<% if(useJquery){%>
			<script src="<%=request.getContextPath()%>/ressource/js/jquery.js"></script>
		<% } %>
		
		<% 
		if(request.getAttribute("redirectionTime") != null && request.getAttribute("redirectionRoute") != null)
		{
			Integer redirectionTime = (Integer) request.getAttribute("redirectionTime");
			String redirectionPath = ((Route) request.getAttribute("redirectionRoute")).getAbsoluteRoute(request);
			%>
			
			<meta http-equiv="refresh" content="<%=redirectionTime %>; url=<%=redirectionPath %>" />
		
		<% } %>
		
	</head>
	
	<body>
	
		<div id="container">
		
			<header>
				<% if (session.getAttribute("User") == null){ %>
				<form id="login_form" method="POST" action="<%=Route.UserConnection.getAbsoluteRoute(request) %>">
					<div>
						<label>E-mail :</label>
						<input type="text" name="<%=IhmValues.FORM_LOGIN_EMAIL %>"/>
					</div>
					<div>
						<label>Mot de passe :</label>
						<input type="password" name="<%=IhmValues.FORM_LOGIN_PASSWORD %>"/>
					</div>
					
					<label>&nbsp;</label>
					<input type="submit" value="Se connecter" />
					
				</form>
				<% } %>
				
				<jsp:include page="menu.jsp"></jsp:include>
			</header>
		
			<div id="content">
			
				<% 
				if (request.getAttribute("message") != null) { %>
			 		<div>
			 			<%= request.getAttribute("message") %>
			 		</div>
			 		<% 
			 	}
				%>
				
				<%
					String toInclude = "views/" + request.getAttribute("jspFile") + ".jsp";
				%>
				
				<jsp:include page="<%=toInclude%>" flush="true" />
				
			</div>
			
			<footer>
				Footer
				<div>©  2014 'E Reverse Uml' </div>
			</footer>

		</div>
	</body>
</html>